package com.neusoft.elmboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.neusoft.elmboot.po.User;
import com.neusoft.elmboot.service.UserService;

@RestController
@RequestMapping("/User")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/Login")
    public User getUserByIdByPass(User user) throws Exception {
        return userService.getUserByIdByPass(user);
    }

    @GetMapping("/UserId")
    public int getUserById(User user) throws Exception {
        return userService.getUserById(user.getUserId());
    }

    @PostMapping("/UserId")
    public int saveUser(User user) throws Exception {
        return userService.saveUser(user);
    }
}